/*
 * @Author: jianghaiyang807
 * @Date:   2016-10-27
 */

import {
  SHOW_LOADING,
  HIDE_LOADING,
  SHOW_ALERT,
  HIDE_ALERT
} from 'actions'
const state = {
  showLoading: false,
  alert: {
    showAlert: false,
    msg: '',
  }
}

const mutations = {
  [SHOW_LOADING](state) {
    state.showLoading = true
  },
  [HIDE_LOADING](state) {
    state.showLoading = false
  },
  [SHOW_ALERT](state, msg) {
    state.alert.msg = msg
    state.alert.showAlert = true
  },
  [HIDE_ALERT](state) {
    state.alert.showAlert = false
  }
}

export default {
  state,
  mutations
}